package com.navajo.web.business;

import org.springframework.beans.factory.annotation.Autowired;

import ru.xpoft.vaadin.DiscoveryNavigator;

import com.navajo.web.business.page.SideBarMenu;
import com.navajo.web.business.view.filesearch.view.FileSearchView;
import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@Theme("chameleon")
public class ApplicationUI extends UI {
	@Autowired
	private SideBarMenu sideBarMenu;
	@Autowired
	private FileSearchView fileSearchView;

	public ApplicationUI() {
		super();
	}

	private DiscoveryNavigator navigator;

	@Override
	protected void init(VaadinRequest request) {

		CssLayout cssLayout = new CssLayout();
		cssLayout.setStyleName("page");

		MyController controller = new MyController();

		VerticalLayout viewContainer = new VerticalLayout();
		VerticalLayout verticalLayout = new VerticalLayout();
		HorizontalLayout horizontalLayout = new HorizontalLayout();
		verticalLayout.addComponent(horizontalLayout);
		VerticalLayout leftVerticalLayout = new VerticalLayout();
		horizontalLayout.addComponent(leftVerticalLayout);
		horizontalLayout.addComponent(viewContainer);
		navigator = new DiscoveryNavigator(this, viewContainer);
		// setContent(verticalLayout);
		navigator.addView("", fileSearchView);
		leftVerticalLayout.addComponent(sideBarMenu);

		cssLayout.addComponent(verticalLayout);
		setContent(cssLayout);

	}
}